package com.dz.service.impl;

import com.dz.bean.GuideLog;
import com.dz.bean.ManagerLog;
import com.dz.bean.VisitorLog;
import com.dz.mapper.GuideLogDao;
import com.dz.mapper.ManagerLogDao;
import com.dz.mapper.VisitorLogDao;
import com.dz.service.LogService;
import com.dz.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LogServiceImpl implements LogService {
    @Autowired
    ManagerLogDao managerLogDao;

    @Autowired
    VisitorLogDao visitorLogDao;

    @Autowired
    GuideLogDao guideLogDao;

    @Override
    public void saveManagerLog(ManagerLog log) {
        managerLogDao.insert(log);
    }

    @Override
    public void saveGuideLog(GuideLog log) {
        guideLogDao.insert(log);
    }

    @Override
    public void saveVisitorLog(VisitorLog log) {
        visitorLogDao.insert(log);
    }

    @Override
    public void pageManagerLogs(Page page, ManagerLog log) {
        int totalCount = managerLogDao.pageCount(log);
        Object data = managerLogDao.page(page,log);
        page.setTotalCount(totalCount);
        page.setData(data);
    }

    @Override
    public void pageGuideLogs(Page page, GuideLog log) {
        int totalCount = guideLogDao.pageCount(log);
        Object data = guideLogDao.page(page,log);
        page.setTotalCount(totalCount);
        page.setData(data);
    }

    @Override
    public void pageVisitorLogs(Page page, VisitorLog log) {
        int totalCount = visitorLogDao.pageCount(log);
        Object data = visitorLogDao.page(page,log);
        page.setTotalCount(totalCount);
        page.setData(data);
    }
}
